<template>
  <div id="app">
    <img src="./assets/logo.png">
    <p>
      <router-link to="/">首页</router-link> |
      <router-link to="/hi">hi页面</router-link> |
<!--      <router-link to="/hi/hi1">-hi1页面</router-link> |-->
      <router-link :to="{name:'Hi1',params:{username:'jspang',id:15}}">-hi1页面</router-link> |
      <router-link to="/hi/hi2">-hi2页面</router-link> |
      <router-link to="/params/12/这是我学习的vue知识">params</router-link> |
      <router-link to="/goHome">goHome</router-link> |
      <router-link to="/goParams/88/学习vue的路由">goParams</router-link> |
      <router-link to="/alias_supplier">供应商的重定向</router-link> |
      <router-link to="/home">home</router-link> |
      <router-link to="/ssss">我是404页面</router-link>
    </p>

    <hr>
    <h2>小帮菜产品介绍</h2>
    <p>
      <router-link to="/supplier" class="cate">供应端</router-link>
      <router-link to="/supplierp" class="cate">批发端</router-link>
      <router-link to="/client" class="cate">客户端</router-link>
      <router-link to="/business" class="cate">企业版</router-link>
    </p>
    <p>{{ $route.name }}</p>
    <hr>
    <h2>单页面多路由</h2>
    <transition name="fade" mode="out-in">
        <router-view/>
    </transition>
    <transition name="fade">
        <router-view name="left" class="left"/>
    </transition>
    <transition name="fade">
        <router-view name="right" class="right"/>
    </transition>

    <hr>
    <button @click="goback">后退</button>
    <button @click="goon">前进</button>
    <button @click="goHome">回首页</button>

  </div>
</template>

<script>
export default {
  name: 'App',
  methods:{
    goback(){
      this.$router.go(-1);
    },
    goon(){
      this.$router.go(1);
    },
    goHome(){
      this.$router.push('/');
    }
  }
}
</script>

<style>
#app {
  font-family: 'Avenir', Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
  #app .cate{
    font-size: 13px;
    text-decoration: none;
    color: #ffffff;
    background: #2980b9;
    display: inline-block;
    width: 100px;
    height: 25px;
    line-height: 25px;
    margin-left: 20px;
  }
#app .cate:hover{
  background: cadetblue;
}
  #app .left{
    width: 50%;
    height: 300px;
    float: left;
    background: #1abc9c;
  }
#app .right{
  width: 50%;
  height: 300px;
  float: left;
  background: #2980b9;
}
.fade-enter{
  opacity: 0;
}
.fade-leave{
  opacity: 1;
}
.fade-enter-active{
  transition: opacity .5s;
}
  /*.fade-leave-active{*/
  /*  opacity: 0;*/
  /*  transition: opacity .5s;*/
  /*}*/
</style>
